]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
[ShellApp] fix app/window sort order
authorDan Winship <danw@gnome.org>
Fri, 16 Oct 2009 14:50:33 +0000 (10:50 -0400)
committerDan Winship <danw@gnome.org>
Fri, 16 Oct 2009 15:15:21 +0000 (11:15 -0400)
The window lists were not being resorted when user-time changed, and
the app list was mistakenly "penalizing" apps for having *any*
minimized windows, rather than for having *only* minimized windows.

https://bugzilla.gnome.org/show_bug.cgi?id=598389

src/shell-app.c

index bc87a1261361375e9f7ee75dea1edc4056790cde..b89fafbec062cfe49fa7f130e49e884abb18cafd 100644 (file)
@@ -151,11 +151,11 @@ shell_app_has_visible_windows (ShellApp   *app)
     {
       MetaWindow *window = iter->data;
 
-      if (!meta_window_showing_on_its_workspace (window))
-        return FALSE;
+      if (meta_window_showing_on_its_workspace (window))
+        return TRUE;
     }
 
-  return TRUE;
+  return FALSE;
 }
 
 gboolean
@@ -242,6 +242,21 @@ shell_app_on_unmanaged (MetaWindow      *window,
   _shell_app_remove_window (app, window);
 }
 
+static void
+shell_app_on_user_time_changed (MetaWindow *window,
+                                GParamSpec *pspec,
+                                ShellApp   *app)
+{
+  /* Ideally we don't want to emit windows-changed if the sort order
+   * isn't actually changing. This check catches most of those.
+   */
+  if (window != app->windows->data)
+    {
+      app->window_sort_stale = TRUE;
+      g_signal_emit (app, shell_app_signals[WINDOWS_CHANGED], 0);
+    }
+}
+
 static void
 shell_app_on_ws_switch (MetaScreen         *screen,
                         int                 from,
@@ -263,6 +278,7 @@ _shell_app_add_window (ShellApp        *app,
 
   app->windows = g_slist_prepend (app->windows, g_object_ref (window));
   g_signal_connect (window, "unmanaged", G_CALLBACK(shell_app_on_unmanaged), app);
+  g_signal_connect (window, "notify::user-time", G_CALLBACK(shell_app_on_user_time_changed), app);
   app->window_sort_stale = TRUE;
 
   g_signal_emit (app, shell_app_signals[WINDOWS_CHANGED], 0);